package com.JavaWk4_3;

import java.util.Comparator;
import java.util.TreeSet;


public class work4_3 {
    public static void main(String[] args) {

        TreeSet<String> set0 = new TreeSet<>(Comparator.comparingInt(String::length).thenComparing(s -> s));

        set0.add("pear");
        set0.add("apple");
        set0.add("banana");
        set0.add("grape");

        System.out.println("最大:" + set0.first());
        System.out.println("最小:" + set0.last());
        System.out.println("倒序排序:");

        for (String s : set0) {
            System.out.println(s);
        }

    }
}

